package com.parenting.controller;


import com.parenting.model.IMPage;
import com.parenting.oauth2.config.AuthUtil;
import com.parenting.request.CollectionSearchRequest;
import com.parenting.response.CollectionListResponse;
import com.parenting.service.ShopCollectionService;
import com.parenting.util.base.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 店铺收藏表  前端控制器
 * </p>
 *
 * @author 烟台业达-王世玺
 * @since 2021-09-26
 */
@RestController
@RequestMapping("/collection")
@Api(tags = "店铺收藏")
@Slf4j
public class ShopCollectionController {

    @Autowired
    private ShopCollectionService shopCollectionService;
    /****
     * 店铺收藏列表
     * @param request
     * @return
     */
    @ApiOperation("店铺收藏表")
    @PostMapping("page")
    public Result<IMPage<CollectionListResponse>> getCollection(@RequestBody  CollectionSearchRequest request){
        log.info("CollectionSearchRequest======================={}",request);
        IMPage<CollectionListResponse> collection = shopCollectionService.getCollection(request, AuthUtil.getUserInfo().getShopId());

        return Result.buildSuccess(collection);
    }
}

